
<?
echo "<form method=\"post\" action=\"../../exportexcel.php\">";
echo "<input type=\"hidden\" name=\"num\" value=10 />";
echo "<input type=\"submit\" value=\"Exportar a Excel\" />";
echo "</form>";
$sso = "SELECT socios.* FROM socios, socio_tiposocio WHERE (socio_tiposocio.idsocio=socios.idsocio AND (socio_tiposocio.idtiposocio=6 OR socio_tiposocio.idtiposocio=12))";
$rsso = mysql_query($sso);
$ult=mysql_num_rows($rsso)-180;
$ultimo=round(mysql_num_rows($rsso)/30);
$pagina=round($_GET[lim]/30) + 2;
$sgt=$_GET[lim]+30;
$ant=$_GET[lim]-30;
$pagant=$pagina-2;
$actual=round($_GET[lim]/30) + 1;
echo "<div align=\"center\"><h3>Pagina $actual</h3></div>";
echo "<table cellspacing=\"2\"><tr>";
if($_GET[lim]==0){

echo "<td><a href=\"versocio.php?lim=$sgt\">Sgte </a></td>";
echo "<td><a href=\"versocio.php?lim=$ult\">Ult </a></td>";}
else{
if($_GET[lim]==$ult){ 
echo "<td><a href=\"versocio.php?lim=0\"> Prim   </a></td>";
echo "<td><a href=\"versocio.php?lim=$ant\">  Ant </a></td>";	}
else
{
echo "<td><a href=\"versocio.php?lim=0\"> Prim</a></td>";
echo "<td><a href=\"versocio.php?lim=$ant\">  Ant </a></td>";	
echo "<td><a href=\"versocio.php?lim=$sgt\"> Sgte </a></td>";
echo "<td><a href=\"versocio.php?lim=$ult\"> Ult</a></td>";	
}}
echo "</tr></table>";
?>
<table width="100%" border="0" cellspacing="2" cellpadding="2" align="center" >
<tr align="center" class="dataheader">
<td></td>

<td></td>
<td>Nº</td>
<td width="80">Nombres</td>
<td>Apellidos</td>
<td>Documento</td>
<td width="280">Direccion</td>
<td>Email</td>
<td>Distrito</td>
<td>Clase</td>
<td>Tipo Socio</td>
<td>Fecha Ingreso</td>
<td>Pago</td>
<td>Fecha Nacimiento</td>
<td>Telefono</td>
<td>Celular</td>
<td>Sexo</td>
<td>Modificado Por</td>
<td>Fecha Modificacion</td>
<?php
function damesql($limite){
$esem=$limite+30;
$sql = "SELECT socios.* FROM socios, socio_tiposocio WHERE (socio_tiposocio.idsocio=socios.idsocio AND (socio_tiposocio.idtiposocio=6 OR socio_tiposocio.idtiposocio=12)) ORDER BY ApPaterno ASC, Nombres ASC LIMIT $limite, 30";
return $sql;}
$sqlf= damesql($_GET[lim]);
$result = mysql_query($sqlf, $link);
$cont=$_GET[lim];
while ($row = mysql_fetch_array($result))
{
$cont++;
echo"<tr class=\"data\" align=\"center\">";
echo "<form method=\"post\" action=\"borrasocio.php\">";
echo "<input type=\"hidden\" value=".$row['idsocio']." name=\"valor\" />";
echo "<input type=\"hidden\" value=".$_GET[lim]." name=\"page\" />";
echo "<td><input type=\"submit\" class=\"buttonmi\"  name=\"borrar\" value=\"Borrar\" /></td>";
echo "</form>";

echo "<form method=\"post\" action=\"edicionsocio.php\">";
echo "<input type=\"hidden\" value=".$row['idsocio']." name=\"valor\" />";
echo "<input type=\"hidden\" value=".$_GET[lim]." name=\"page\" />";
echo "<td><input type=\"submit\"  class=\"buttonmi\" name=\"edit\" value=\"Editar\" /></td>";
echo "</form>";
echo "<td>".$cont."</td>";
echo "<td width=\"80\">".utf8_encode(ucwords(strtolower($row['Nombres'])))."</td>";
echo "<td>".utf8_encode(ucwords(strtolower($row['ApPaterno'])))." ".utf8_encode(ucwords(strtolower($row['ApMaterno'])))."</td>";
echo "<td>".$row['DNI']."</td>";
$direccion=$row['Direccion'];
echo "<td width=\"280\">".$direccion."</td>";
echo "<td>".$row['Email']."</td>";
$sql2= "Select Distrito FROM distrito where IdDistrit=".$row['IdDistrito'];
$result2 = mysql_query($sql2, $link);
$row2= mysql_fetch_array($result2);
echo "<td>".$row2['Distrito']."</td><td><table>";
//echo "<td>".$row['FechaRenovacion']."</td>";
/*if($row['Renovo']==1){
echo "<td>Si</td>";}else
{echo "<td>No</td>";}*/
$sqlst1= "Select * FROM socio_tiposocio where idsocio=".$row['idsocio'];
$resultst1 = mysql_query($sqlst1, $link);
while($rowst1= mysql_fetch_array($resultst1)){

$sql3= "Select Clase FROM clase where Idclase=".$rowst1['IdClase'];
$result3 = mysql_query($sql3, $link);
$row3= mysql_fetch_array($result3);
echo "<tr><td>".$row3['Clase']."</td></tr>";
}
echo "</table></td><td><table>";
$sqlst= "Select * FROM socio_tiposocio where idsocio=".$row['idsocio'];
$resultst = mysql_query($sqlst, $link);
while($rowst= mysql_fetch_array($resultst)){
echo "<tr><td>";
$sql4= "Select TipoSocio FROM tiposocio where idTipoSocio=".$rowst['idtiposocio'];
$result4 = mysql_query($sql4, $link);
$row4= mysql_fetch_array($result4);
echo $row4['TipoSocio']."\n" ;
echo "</td></tr>";
  }
echo "</table></td><td><table>";
$resultst1 = mysql_query($sqlst, $link);
while($rowst1= mysql_fetch_array($resultst1)){
echo "<tr><td>";
echo $rowst1['FechaIngreso']."\n" ;
echo "</td></tr>";
  }
echo "</table></td><td><table>";
$resultst2 = mysql_query($sqlst, $link);
while($rowst2= mysql_fetch_array($resultst2)){
$sql41= "Select * FROM moneda where idmoneda=".$rowst2['idmoneda'];
$result41 = mysql_query($sql41, $link);
$row41= mysql_fetch_array($result41);
echo "<tr><td>";
echo $row41['tagmon']." ".$rowst2['pago']."\n" ;
echo "</td></tr>";
  }
echo "</table></td>";  
/*$sql4= "Select TipoSocio FROM tiposocio where idTipoSocio=".$row['idTipoSocio'];
$result4 = mysql_query($sql4, $link);
$row4= mysql_fetch_array($result4);
echo "<td>".$row4['TipoSocio']."</td>";*/
echo "<td>".$row['FechaNacimiento']."</td>";
echo "<td>".$row['Telefono']."</td>";
echo "<td>".$row['Celular']."</td>";
echo "<td>".$row['IdSexo']."</td>";
echo "<td>".$row['editadopor']."</td>";
echo "<td>".$row['edicion']."</td>";
echo"</tr>";
}
?>
</table>

<?php 
echo "<table cellspacing=\"2\"><tr>";
if($_GET[lim]==0){

echo "<td><a href=\"versocio.php?lim=$sgt\">Sgte </a></td>";
echo "<td><a href=\"versocio.php?lim=$ult\"> Ult</a></td>";}
else{
if($_GET[lim]==$ult){ 
echo "<td><a href=\"versocio.php?lim=0\"> Prim</a></td>";
echo "<td><a href=\"versocio.php?lim=$ant\">  Ant </a></td>";	}
else
{
echo "<td><a href=\"versocio.php?lim=0\"> Prim </a></td>";
echo "<td><a href=\"versocio.php?lim=$ant\">  Ant </a></td>";	
echo "<td><a href=\"versocio.php?lim=$sgt\">  Sgte </a></td>";
echo "<td><a href=\"versocio.php?lim=$ult\"> Ult</a></td>";	
}}
echo "</tr></table>";
?>
